Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build ember_debug with vite #2458

Closed
wants to merge 21 commits into from
Closed

Conversation

patricklx
Copy link
Collaborator

@patricklx patricklx commented Aug 29, 2023

and selective choose what we actually need from the clients ember
ember_debug.js 382.13 kB │ gzip: 118.16 kB when minimized

fixes #2457

This is actually not required. But it could reduce the things we need to import from the clients ember

@patricklx
Copy link
Collaborator Author

this will not work after all...
missing @glimmer/runtime in the client app and other required ones...

@patricklx patricklx closed this Aug 29, 2023
@patricklx patricklx reopened this Aug 29, 2023
@patricklx
Copy link
Collaborator Author

Reopen, this could minimise the setup clients need to do to get inspector working

@patricklx patricklx marked this pull request as ready for review August 29, 2023 15:22
@RobbieTheWagner
Copy link
Member

@patricklx this seems to break Ember < 3.28. If this is something we are going to need, we will have to cut a new legacy branch and make the main branch only support Ember 3.28+

@patricklx
Copy link
Collaborator Author

I could probably support older versions as well. But we need a compat adapter anyway. This just reduces it

@patricklx
Copy link
Collaborator Author

patricklx commented Aug 30, 2023

🎉
it works, but I don't think we gain much.
So, just a nice proof of concept. :)

It reduces the deps on client ember to

  • @ember/runloop
  • @ember/-internals/views
  • @ember/instrumentation
  • @ember/debug
  • @ember/-internals/utils
  • @ember/object/internals
  • @glimmer/component
  • @glimmer/runtime
  • rsvp
  • ember

@patricklx
Copy link
Collaborator Author

@NullVoxPopuli @RobbieTheWagner
Do you think it makes sense to continue work on this?
I can try to remove the require('ember') call as well and use direct imports of the needed deps

@NullVoxPopuli
Copy link
Contributor

NullVoxPopuli commented Aug 30, 2023

maybe -- I'm not entirely sure what the purpose is -- in my 5.2 app with staticEmberSource enabled, I still get an error:
image
image

does this work make progress towards fixing that? I presume by somehow adding in modules that an app may not have?

@patricklx
Copy link
Collaborator Author

Well, this will at least reduce those issues.
Whats missing there for example is the runloop, specifically, the backburner export.
But that is required to have from the client app. And having that export will not increase your apps size.
The biggest issue i think is the dependency on require ember, but ember_debug does not actually need all.

@patricklx
Copy link
Collaborator Author

Actually, we could also fallback to own runloop, but then we need to have a setup a interval, so that backburner will be invoked.
Will then be poll based instead.

@patricklx
Copy link
Collaborator Author

this now works on limber
but

  • no tracked detection
  • polling based
  • current inspect object is also iterated over all props without checking for changes (need @glimmer/validator)
  • no promise inspection (need rsvp)
  • no data tab (maybe you do not have?)

@patricklx patricklx marked this pull request as draft August 31, 2023 11:40
@patricklx patricklx closed this Sep 9, 2023
@NullVoxPopuli
Copy link
Contributor

Why close?

@patricklx
Copy link
Collaborator Author

patricklx commented Sep 9, 2023

This fixes only half of the problem.
It makes ember_debug use it's own ember. But it still needs access to multiple parts of the clients ember to do the debugging.
And all the parts ember_debug depends on, are already in the clients ember, also with static ember. Just not exposed via the amd loader.
I think ember_debug could also be refactored to reduce usage of ember and instead use more native things like classes and getters. Which would also reduce the dependency on ember object, computed etc

@NullVoxPopuli
Copy link
Contributor

NullVoxPopuli commented Sep 9, 2023

One idea someone had yesterday was to:

  • make ember inspector wholly use its own ember-source
  • have ember-source provide an "adapter" to hook in to the inspector, the same way ember-data does -- that way ember-source is responsible for compatibility, rather than the inspector. This could also lead to user-land customizations / enhancements of how things show up. And it would solve the missing modules problem, because everything needed would be "await imported" by the app.

thoughts?

@patricklx
Copy link
Collaborator Author

Sounds good to me. could be backported to earlier ember versions?
There is actually already ember/debug for that.
The problem is in earlier versions it did not provide enough debug tooling for specific things like tracked detection and tracked dependency detection.
Which is done now in a hacky way.

@NullVoxPopuli
Copy link
Contributor

could be backported to earlier ember versions?

at the very least LTSes -- but it's not unheard of for folks on older embers to use older ember-inspectors

@RobbieTheWagner
Copy link
Member

I think this is a slippery slope to try to have ember_debug ship its own Ember. It runs in the context of your app, so as Ember changes, it's going to be constant whack-a-mole trying to make all the things work. I personally think it's okay if a user decides to strip out parts of Ember in production and Ember Inspector doesn't work then. It should still work in dev mode.

If we want to build public APIs into ember-source for compatibility, I am all for that. Not using hacks, and instead using a tailor made API that just does all the debug stuff would be much preferred and would guarantee we don't break inspector in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaks on ember 5.2 w/ staticEmberSource: true
3 participants